﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Pku.BookStore.IServices;

namespace Pku.BookStore.Services
{
    public class CommentServices : ICommentServices
    {
        /// <summary>
        /// 获取实例名
        /// </summary>
        private DAL.CommentDAL commentDal
        {
            get
            {
                return new DAL.CommentDAL();
            }
        }

        /// <summary>
        /// 增加数据
        /// </summary>
        /// <param name="entity"></param>
        public int Add(Model.CommentModel entity)
        {
            return commentDal.Add(entity);
        }

        /// <summary>
        /// 修改数据
        /// </summary>
        /// <param name="entity"></param>
        public bool Modify(Model.CommentModel entity)
        {
            return commentDal.Modify(entity);
        }

        /// <summary>
        /// 查询
        /// </summary>
        /// <returns></returns>
        public List<Model.CommentModel> Search(Model.CommentParam param)
        {
            return commentDal.Search(param);
        }

        /// <summary>
        ///  获取实体
        /// </summary>
        /// <param name="commentID"></param>
        /// <returns></returns>
        public Model.CommentModel GetEntityById(int commentID)
        {
            return commentDal.GetEntityById(commentID);
        }

        /// <summary>
        /// 是否存在
        /// </summary>
        /// <param name="Str">关键字</param>
        /// <returns></returns>
        public bool Exist(int BookID, int UserID)
        {
            return commentDal.Exist(BookID, UserID);
        }

        /// <summary>
        /// 获取总数
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public int GetCount(Model.PublisherParam param)
        {
            return commentDal.GetCount(param);
        }


        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="CategoryID"></param>
        /// <returns></returns>
        public bool Delete(int CommentID)
        {
            return commentDal.Delete(CommentID);
        }
    }
}
